<!DOCTYPE html>
<html>
<head>
    <title>Intermediate Value Models - Comparison Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1400px;
            margin: 0 auto;
            background-color: white;
            padding: 30px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            border-bottom: 3px solid #4CAF50;
            padding-bottom: 10px;
        }
        h2 {
            color: #555;
            margin-top: 30px;
        }
        table {
            border-collapse: collapse;
            width: 100%;
            margin: 20px 0;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #4CAF50;
            color: white;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        .sig-high { background-color: #d4edda; }
        .sig-medium { background-color: #fff3cd; }
        .sig-low { background-color: #f8d7da; }
        .metric { font-weight: bold; }
        .timestamp {
            color: #888;
            font-size: 0.9em;
        }
        img {
            max-width: 100%;
            margin: 20px 0;
            border: 1px solid #ddd;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Intermediate Value Models - Correlation Analysis Report</h1>
        <p class="timestamp">Generated: 2025-10-13 21:05:10</p>
        
        <h2>Overall Ranking (Top 20)</h2>
        <table>
            <tr>
                <th>Rank</th>
                <th>Algorithm</th>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>CPU Mean</th>
            </tr>

            <tr class="sig-medium">
                <td>1</td>
                <td>ECC-P256</td>
                <td>hw_coordinate</td>
                <td class="metric">0.6559</td>
                <td>0.039477</td>
                <td>strong</td>
                <td>37.08%</td>
            </tr>

            <tr class="sig-low">
                <td>2</td>
                <td>SM2</td>
                <td>point_add_x</td>
                <td class="metric">0.5603</td>
                <td>0.190811</td>
                <td>strong</td>
                <td>39.02%</td>
            </tr>

            <tr class="sig-low">
                <td>3</td>
                <td>AES-128</td>
                <td>sbox_output</td>
                <td class="metric">0.5461</td>
                <td>0.128237</td>
                <td>strong</td>
                <td>54.67%</td>
            </tr>

            <tr class="sig-low">
                <td>4</td>
                <td>RSA-2048</td>
                <td>modular_add</td>
                <td class="metric">0.5063</td>
                <td>0.164298</td>
                <td>strong</td>
                <td>42.45%</td>
            </tr>

            <tr class="sig-low">
                <td>5</td>
                <td>SM2</td>
                <td>modular_op</td>
                <td class="metric">0.5019</td>
                <td>0.251064</td>
                <td>strong</td>
                <td>56.75%</td>
            </tr>

            <tr class="sig-low">
                <td>6</td>
                <td>RSA-2048</td>
                <td>hw_result</td>
                <td class="metric">0.4548</td>
                <td>0.257558</td>
                <td>moderate</td>
                <td>40.80%</td>
            </tr>

            <tr class="sig-low">
                <td>7</td>
                <td>SM4</td>
                <td>sbox_output</td>
                <td class="metric">0.4142</td>
                <td>0.267695</td>
                <td>moderate</td>
                <td>52.50%</td>
            </tr>

            <tr class="sig-low">
                <td>8</td>
                <td>Dilithium-2</td>
                <td>modular_red</td>
                <td class="metric">0.4117</td>
                <td>0.310885</td>
                <td>moderate</td>
                <td>48.93%</td>
            </tr>

            <tr class="sig-low">
                <td>9</td>
                <td>Dilithium-2</td>
                <td>rejection_sampling</td>
                <td class="metric">0.3771</td>
                <td>0.282687</td>
                <td>moderate</td>
                <td>24.25%</td>
            </tr>

            <tr class="sig-low">
                <td>10</td>
                <td>SM4</td>
                <td>hw_sbox_output</td>
                <td class="metric">0.3617</td>
                <td>0.304432</td>
                <td>moderate</td>
                <td>30.71%</td>
            </tr>

            <tr class="sig-low">
                <td>11</td>
                <td>ECC-P256</td>
                <td>point_add_x</td>
                <td class="metric">0.3589</td>
                <td>0.342883</td>
                <td>moderate</td>
                <td>27.40%</td>
            </tr>

            <tr class="sig-low">
                <td>12</td>
                <td>AES-128</td>
                <td>round_key_xor</td>
                <td class="metric">0.2538</td>
                <td>0.509902</td>
                <td>weak</td>
                <td>37.74%</td>
            </tr>

            <tr class="sig-low">
                <td>13</td>
                <td>AES-128</td>
                <td>hw_round_key_xor</td>
                <td class="metric">0.2363</td>
                <td>0.573204</td>
                <td>weak</td>
                <td>39.10%</td>
            </tr>

            <tr class="sig-low">
                <td>14</td>
                <td>ECC-P256</td>
                <td>scalar_mult_step</td>
                <td class="metric">0.2160</td>
                <td>0.548871</td>
                <td>weak</td>
                <td>34.39%</td>
            </tr>

            <tr class="sig-low">
                <td>15</td>
                <td>AES-128</td>
                <td>hd_plaintext_sbox</td>
                <td class="metric">0.1616</td>
                <td>0.677841</td>
                <td>weak</td>
                <td>37.50%</td>
            </tr>

            <tr class="sig-low">
                <td>16</td>
                <td>SM4</td>
                <td>round_function_input</td>
                <td class="metric">0.1447</td>
                <td>0.732434</td>
                <td>weak</td>
                <td>39.78%</td>
            </tr>

            <tr class="sig-low">
                <td>17</td>
                <td>Dilithium-2</td>
                <td>ntt_butterfly</td>
                <td class="metric">0.1064</td>
                <td>0.769943</td>
                <td>weak</td>
                <td>27.37%</td>
            </tr>

            <tr class="sig-low">
                <td>18</td>
                <td>RSA-2048</td>
                <td>modular_mult</td>
                <td class="metric">0.0914</td>
                <td>0.829627</td>
                <td>very_weak</td>
                <td>40.15%</td>
            </tr>

            <tr class="sig-low">
                <td>19</td>
                <td>SM4</td>
                <td>tau_transform</td>
                <td class="metric">0.0776</td>
                <td>0.842661</td>
                <td>very_weak</td>
                <td>34.71%</td>
            </tr>

            <tr class="sig-low">
                <td>20</td>
                <td>SM4</td>
                <td>sbox_input</td>
                <td class="metric">0.0683</td>
                <td>0.872260</td>
                <td>very_weak</td>
                <td>34.92%</td>
            </tr>

        </table>
        
        <h2>Visualization</h2>
        <img src="overall_ranking.png" alt="Overall Ranking">
        <img src="algorithm_comparison.png" alt="Algorithm Comparison">
        
        <h2>By Algorithm</h2>

        <h3>AES-128</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.5461</td>
                <td>0.128237</td>
                <td>strong</td>
                <td>0.3167</td>
                <td>54.67%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>round_key_xor</td>
                <td class="metric">0.2538</td>
                <td>0.509902</td>
                <td>weak</td>
                <td>0.5105</td>
                <td>37.74%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>hw_round_key_xor</td>
                <td class="metric">0.2363</td>
                <td>0.573204</td>
                <td>weak</td>
                <td>-0.5401</td>
                <td>39.10%</td>
                <td>6</td>
            </tr>

            <tr class="sig-low">
                <td>hd_plaintext_sbox</td>
                <td class="metric">0.1616</td>
                <td>0.677841</td>
                <td>weak</td>
                <td>-0.0972</td>
                <td>37.50%</td>
                <td>4</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.0275</td>
                <td>0.944032</td>
                <td>very_weak</td>
                <td>-0.1841</td>
                <td>33.35%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>hw_sbox_output</td>
                <td class="metric">0.0260</td>
                <td>0.946988</td>
                <td>very_weak</td>
                <td>0.0558</td>
                <td>42.06%</td>
                <td>5</td>
            </tr>

        </table>

        <h3>Dilithium-2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>modular_red</td>
                <td class="metric">0.4117</td>
                <td>0.310885</td>
                <td>moderate</td>
                <td>-0.5238</td>
                <td>48.93%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>rejection_sampling</td>
                <td class="metric">0.3771</td>
                <td>0.282687</td>
                <td>moderate</td>
                <td>-0.2638</td>
                <td>24.25%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>ntt_butterfly</td>
                <td class="metric">0.1064</td>
                <td>0.769943</td>
                <td>weak</td>
                <td>-0.2270</td>
                <td>27.37%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>poly_mult</td>
                <td class="metric">0.0529</td>
                <td>0.892476</td>
                <td>very_weak</td>
                <td>0.1172</td>
                <td>37.56%</td>
                <td>10</td>
            </tr>

        </table>

        <h3>ECC-P256</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-medium">
                <td>hw_coordinate</td>
                <td class="metric">0.6559</td>
                <td>0.039477</td>
                <td>strong</td>
                <td>0.7103</td>
                <td>37.08%</td>
                <td>7</td>
            </tr>

            <tr class="sig-low">
                <td>point_add_x</td>
                <td class="metric">0.3589</td>
                <td>0.342883</td>
                <td>moderate</td>
                <td>-0.0418</td>
                <td>27.40%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>scalar_mult_step</td>
                <td class="metric">0.2160</td>
                <td>0.548871</td>
                <td>weak</td>
                <td>0.2270</td>
                <td>34.39%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.0256</td>
                <td>0.951942</td>
                <td>very_weak</td>
                <td>-0.0714</td>
                <td>43.28%</td>
                <td>10</td>
            </tr>

        </table>

        <h3>RSA-2048</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>modular_add</td>
                <td class="metric">0.5063</td>
                <td>0.164298</td>
                <td>strong</td>
                <td>0.5439</td>
                <td>42.45%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>hw_result</td>
                <td class="metric">0.4548</td>
                <td>0.257558</td>
                <td>moderate</td>
                <td>0.5279</td>
                <td>40.80%</td>
                <td>5</td>
            </tr>

            <tr class="sig-low">
                <td>modular_mult</td>
                <td class="metric">0.0914</td>
                <td>0.829627</td>
                <td>very_weak</td>
                <td>0.0000</td>
                <td>40.15%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>square_op</td>
                <td class="metric">0.0434</td>
                <td>0.926384</td>
                <td>very_weak</td>
                <td>-0.5000</td>
                <td>50.69%</td>
                <td>10</td>
            </tr>

        </table>

        <h3>SM2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>point_add_x</td>
                <td class="metric">0.5603</td>
                <td>0.190811</td>
                <td>strong</td>
                <td>-0.5714</td>
                <td>39.02%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>modular_op</td>
                <td class="metric">0.5019</td>
                <td>0.251064</td>
                <td>strong</td>
                <td>0.2143</td>
                <td>56.75%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.0227</td>
                <td>0.953804</td>
                <td>very_weak</td>
                <td>-0.0921</td>
                <td>33.47%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>scalar_mult_step</td>
                <td class="metric">0.0030</td>
                <td>0.993443</td>
                <td>very_weak</td>
                <td>0.0061</td>
                <td>30.91%</td>
                <td>10</td>
            </tr>

        </table>

        <h3>SM4</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.4142</td>
                <td>0.267695</td>
                <td>moderate</td>
                <td>-0.5272</td>
                <td>52.50%</td>
                <td>9</td>
            </tr>

            <tr class="sig-low">
                <td>hw_sbox_output</td>
                <td class="metric">0.3617</td>
                <td>0.304432</td>
                <td>moderate</td>
                <td>0.3344</td>
                <td>30.71%</td>
                <td>5</td>
            </tr>

            <tr class="sig-low">
                <td>round_function_input</td>
                <td class="metric">0.1447</td>
                <td>0.732434</td>
                <td>weak</td>
                <td>-0.2755</td>
                <td>39.78%</td>
                <td>9</td>
            </tr>

            <tr class="sig-low">
                <td>tau_transform</td>
                <td class="metric">0.0776</td>
                <td>0.842661</td>
                <td>very_weak</td>
                <td>0.1167</td>
                <td>34.71%</td>
                <td>10</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.0683</td>
                <td>0.872260</td>
                <td>very_weak</td>
                <td>-0.0476</td>
                <td>34.92%</td>
                <td>9</td>
            </tr>

        </table>

        <h2>Legend</h2>
        <ul>
            <li><strong>|Pearson|:</strong> Absolute value of Pearson correlation coefficient (0-1)</li>
            <li><strong>P-value:</strong> Statistical significance (< 0.05 is significant)</li>
            <li><strong>Significance:</strong> Correlation strength category</li>
            <li><strong>CPU Mean:</strong> Average CPU usage during trace collection</li>
            <li class="sig-high">Green background: Highly significant (p < 0.01)</li>
            <li class="sig-medium">Yellow background: Significant (p < 0.05)</li>
            <li class="sig-low">Red background: Not significant (p >= 0.05)</li>
        </ul>
    </div>
</body>
</html>
